package com.test.it;

import java.util.*;

/**
 * 数组通过Arrays.asList方法实例化的List对象，保持了数组的特性，remove其item会抛出异常
 */
public class ItDemo {

    public static void main(String[] args) {
//        List<Integer> ls = Arrays.asList(new Integer[] {11, 22, 33, 44, 55});

//        ls.forEach(ss -> {
//            System.out.println(ss + "=========================================");
            List<Integer> list = Arrays.asList(new Integer[] {1, 2, 3, 4, 5});
            Iterator<Integer> it = list.iterator();
            while(it.hasNext()) {
                if (it.next() == 1) {
                    it.remove();
                }
            }
            for (int s : list ) {
                System.out.println(s);
            }
//        });
    }
}
